﻿{extend name="public:base" /}

{block name="content"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox ">
                <div class="ibox-content">
                    <div class="table-responsive">
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>头像</th>
                                <th>昵称</th>
                                <th>手机号</th>
                                <th>收款二维码</th>
                                <th>注册时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name="list" id="vo"}
                            <tr>
                                <td>{$vo.id}</td>
                                <td><img src="{$vo.avatar|getPicture}" style="width: 100px;height: 100px; object-fit: cover; border-radius: 50%" /></td>
                                <td>{$vo.username}</td>
                                <td>{$vo.mobile}</td>
                                <td><img src="{$vo.payment_qr|getPicture}" style="width: 100px;height: 100px; object-fit: cover" /></td>
                                <td>{:timeFormat($vo.create_time)}</td>
                                <td class="project-actions">
                                    <a href="{:url('spreadList', ['id' => $vo.id])}" class="btn btn-white btn-sm">
                                        <i class="iconfont icon-users"></i> 推广列表
                                    </a>
                                </td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                        {if !empty($list)}{$list->render()}{/if}
                    </div>

                </div>
            </div>
        </div>

    </div>
</div>

{/block}

{block name="js"}
<script>
    var type_list = {$type_list_json};

    // 搜索跳转后二级分类回显
    var one_type_id = "{:input('one_type_id')}";
    if(one_type_id) changeOneType(this, one_type_id);

    // 选中一级分类渲染二级分类
    function changeOneType(that, get_one_type_id = 0){
        var one_type_id = get_one_type_id ? get_one_type_id : $(that).val();

        var option = "<option value='0'>请选择二级分类</option>";
        for (var i = 0; i < type_list.length; i++) {
            if (one_type_id == type_list[i].id) {
                var son_list = type_list[i].son_list;
                if (son_list.length > 0) {
                    son_list.forEach(function (val) {
                        var two_type_id = "{:input('two_type_id')}";
                        var selected = two_type_id == val.id ? "selected" : "";

                        option += "<option value='" + val.id + "' "+ selected +">" + val.name + "</option>"
                    })
                }
                break;
            }
        }
        $('.two_type').html(option)
    }
</script>
{/block}

